package com.itheima.test16;

import java.util.Objects;

public class Student extends Person {
    private String id;

    public Student() {
    }

    public Student(String name, int age, String id) {
        super(name, age);
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(id, student.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    @Override
    public String toString() {
        return "Student{" + "id='" + id + '\'' + "name='" + getName() + '\'' +
                "age='" + getAge() + '\'' +
                '}';
    }

    @Override
    public void work() {
        System.out.println("好好学习");
    }
}
